#ifndef CPP_FONTMANAGER_H
#define CPP_FONTMANAGER_H

#include <Font.h>
#include <Global.h>
#include <map>
#include <string>

//@brief 字体管理器
//@author cvte
class FontManager {
   public:
    static Font& getFont(const char* fontName, int size);
    static bool deleteFont(const char* fontName, int size);
    static Font& getFont(Font::Builder& builder);
    static bool deleteFont(Font::Builder& builder);
   private:
    static FontManager* sInstance;
    typedef std::map<std::string, Font*> FontMap;
    FontMap mFontMap;

    FontManager();
    ~FontManager();
    static FontManager* getInstance();
    Font* getFontFromMap(const char* fontName, int size);
    bool deleteFontFromMap(const char* fontName, int size);
    Font* getFontFromMap(Font::Builder& builder);
    bool deleteFontFromMap(Font::Builder& builder);
};

#endif